package com.zhang.postgresql.common.model;

import lombok.Data;
import org.apache.logging.log4j.util.Strings;

/**
 * 请求的基础分页数据
 *
 * @author zhangFanJun
 * @date 2022-09-08 17:02
 **/
@Data
public class BasePage implements IBasePage {
    private long pageNum = 1L;
    private long pageSize = 10L;
    private String orderBy;
    /**
     * 1是正序，0，是倒序
     * 适配老接口，如果是新项目就不要用sort字段
     * */
    public int sort;
    private boolean asc;
    private boolean desc;

    public static final int ASC = 1;

    public String getOrderBy() {
        if (Strings.isBlank(orderBy)) {
            return getDefaultSortBy();
        }
        return orderBy;
    }

    @Override
    public String getDefaultSortBy() {
        return null;
    }
}
